package com.lanou3g.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

public class DemoInterceptor implements HandlerInterceptor {
    @Override
    //这个方法是在进入controller之前验证的
    public boolean preHandle(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Object o) throws Exception {
        System.out.println("preHandle-------------------------");
        return false;//返回false,就是一直被拦截的意思;true就继续走
    }

    @Override
    //这个方法是在jsp渲染成html页面前运行的
    public void postHandle(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
        System.out.println("posthandle------------------------");
    }

    @Override
    //这个方法是在jsp渲染成html页面后运行的
    public void afterCompletion(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
        System.out.println("afterHandle------------------------");
    }
}
